ab0275d580155220fa92ac7fa560768fef08952b,components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java,HttpComponent,createEndpoint,#String#String#Map#,160
Before Change
}
}
endpoint.setHttpUri(httpUri);
setEndpointHeaderFilterStrategy(endpoint);
endpoint.setBinding(getHttpBinding());
if (httpBinding != null) {
endpoint.setHttpBinding(httpBinding);
After Change
}
String httpMethodRestrict = getAndRemoveParameter(parameters, "httpMethodRestrict", String.class);
HeaderFilterStrategy headerFilterStrategy = resolveAndRemoveReferenceParameter(parameters, "headerFilterStrategy", HeaderFilterStrategy.class);
boolean secure = HttpHelper.isSecureConnection(uri);
// create the configurer to use for this endpoint
HttpClientConfigurer configurer = createHttpClientConfigurer(parameters, secure);
URI endpointUri = URISupport.createRemainingURI(new URI(addressUri), httpClientParameters);
// create the endpoint and set the http uri to be null
HttpEndpoint endpoint = new HttpEndpoint(endpointUri.toString(), this, clientParams, clientConnectionManager, configurer);
// configure the endpoint
setProperties(endpoint, parameters);
// The httpUri should be start with http or https
String httpUriAddress = addressUri;
if (addressUri.startsWith("http4")) {
httpUriAddress = "http" + addressUri.substring(5);
}
if (addressUri.startsWith("https4")) {
httpUriAddress = "https" + addressUri.substring(6);
}
// restructure uri to be based on the parameters left as we dont want to include the Camel internal options
// build up the http uri
URI httpUri = URISupport.createRemainingURI(new URI(httpUriAddress), parameters);
// validate http uri that end-user did not duplicate the http part that can be a common error
String part = httpUri.getSchemeSpecificPart();
if (part != null) {
part = part.toLowerCase();
if (part.startsWith("//http//") || part.startsWith("//https//") || part.startsWith("//http://") || part.startsWith("//https://")) {
throw new ResolveEndpointFailedException(uri,
"The uri part is not configured correctly. You have duplicated the http(s) protocol.");
}
}
endpoint.setHttpUri(httpUri);
if (headerFilterStrategy != null) {
endpoint.setHeaderFilterStrategy(headerFilterStrategy);
} else {
setEndpointHeaderFilterStrategy(endpoint);
}
endpoint.setBinding(getHttpBinding());
if (httpBinding != null) {